# -*- coding:utf-8 -*-
# author: helili
# @Time: 2020/11/5 上午11:19

from loguru import logger
import os
import time

# 获取当前目录的父目录的绝对路径
current_path = os.path.dirname(os.path.dirname(__file__))

# logger日志配置
report_log_path = os.path.join(current_path, "report_log")
# 测试报告和日志的目录
if not os.path.exists(report_log_path):
    os.mkdir(report_log_path, mode=0o777)

today = time.strftime("%Y-%m-%d", time.localtime())
# 年月日
logging_file = os.path.join(report_log_path, "log{}.log".format(today))

logger.add(
    logging_file,
    format="{time:YYYY-MM-DD HH:mm:ss}|{level}|{message}",
    level="INFO",
    rotation="100 MB",
    encoding="utf-8",
)

# BeautifulReport配置
beautiful_filename = "mocne_UI_report"
beautiful_description = "mocne_UI测试报告"
